const config = (_this) => {
  return {
    // 表格
    table: {
      isSelectFlag: false,
      compRef: "yjrblb",
      isSequenceFlag: true,
      isShowPage: true,
      resetFlag: true,
      loading: false,
      title: "响应命令单列表",
      actions: [],
      tableData: [],
      columns: [
        {
          prop: "responseName",
          label: "响应命令单",
          align: "left",
          "min-width": "230px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span
                    style='width: 100%;' class='commonTableStyle'
                    {...{
                      on: {
                        click: () => {
                          _this.detailList(row);
                        }
                      }
                    }}
                  >
                    {row.responseName}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "eventName",
          label: "事件类别",
          "min-width": "70px",
          align: "center"
        },
        {
          prop: "responseLvName",
          label: "响应级别",
          "min-width": "70px",
          align: "center"
        },
        {
          prop: "effectRange",
          label: "影响范围",
          align: "center"
        },
        {
          prop: "effectTime",
          label: "影响时间",
          align: "left",
          "min-width": "120px",
          render: (h, { row }) => {
            return (
              <div>
                {
                  <span>
                    {row.effectTime}
                  </span>
                }
              </div>
            );
          }
        },
        {
          prop: "linkman",
          label: "联系人",
          "min-width": "120px",
          align: "center",
          "show-overflow-tooltip": true
        },
        {
          prop: "approvalDept",
          label: "发布单位",
          "min-width": "120px",
          align: "left"
        },
        {
          prop: "approvalTime",
          label: "发布时间",
          align: "center",
          "min-width": "130px"

        },
        {
          prop: "terminateTime",
          label: "终止时间",
          align: "center",
          "min-width": "130px"
        },
        {
          prop: "responseState",
          label: "状态",
          align: "center",
          "min-width": "80px",
          formatter: (row, column, cellValue, index) => {
            if (cellValue === "0") {
              return "编辑中";
            } else if (cellValue === "1") {
              return "待审批";
            } else if (cellValue === "2") {
              return "已发布";
            } else if (cellValue === "3") {
              return "驳回";
            } else if (cellValue === "4") {
              return "终止";
            } else if (cellValue === "7") {
              return "已调整";
            }
          }
        },
        {
          prop: "cz",
          label: "操作",
          align: "center",
          fixed: "right",
          "min-width": "150px",
          render: (h, scope) => {
            let arr = [];
            const tbPower = _this.common.isHasPower("tbr");
            // const spPower = _this.common.isHasPower("spr");
            const userId = JSON.parse(sessionStorage.getItem("account")).id;
            if (["0", "3"].includes(scope.row.responseState) && tbPower && scope.row.operate === true) {
              arr = ["编辑", "删除"];
            } else if (scope.row.responseState === "1" && scope.row.nextAssignee && scope.row.nextAssignee.includes(userId)) {
              arr = ["审批"];
            } else if (scope.row.responseState === "2" && tbPower && scope.row.operate === true) {
              if (scope.row.hasHeadquarters !== 0) {
                arr = ["查看指挥部", "调整", "终止"];
              } else {
                arr = ["调整", "终止"];
              }

            } else if (scope.row.responseState === "4" && tbPower && scope.row.operate === true) {
              arr = ["预览"];
            }

            return (
              <div>
                {
                  arr.map(item => {
                    return (
                      <span style='color:#3561fd;cursor:pointer;text-decoration: underline;margin:0 2px' {...{
                        on: {
                          click: () => {
                            _this.actionHandle(item, scope);
                          }
                        }
                      }}>
                        {item}
                      </span>
                    );
                  })
                }
              </div >
            );
          }
        }
      ],
      tableAttr: {
        // "max-height": "430px",
        // height: "430px",
        stripe: false,
        border: true,
        fit: true,
        // "span-method": ({ row, column, rowIndex, columnIndex }) => {
        //   // console.log(row, '>>>>>>>>>row');
        //   // console.log(column, '>>>>>>>>>column');
        //   // console.log(rowIndex, '>>>>>>>>>rowIndex');
        //   // console.log(columnIndex, '>>>>>>>>>columnIndex');
        //   console.log(_this.config.table.tableData, '>>>>>tableData');
        // },
        "show-header": true,
        "highlight-current-row": true,
        "cell-style": {
          "font-size": "16px"
        },
        "header-cell-style": {
          "text-align": "center",
          "background-color": "#B1C8F9",
          border: "1px solid #ccc",
          "font-size": "16px"
        }
      },
      // 分页信息
      paginationAtrrs: {
        total: 0,
        layout: " prev, pager, next",
        "current-page": 1,
        "page-size": 10
      }
    },
    // 表格
    table1: {
      isSelectFlag: false,
      compRef: "xzdw",
      isSequenceFlag: true,
      isShowPage: false,
      autoHeight: true,
      resetFlag: true,
      loading: false,
      title: "",
      actions: [],
      tableData: [
        {
          taskContent: "",
          dutyDeptId: ""
        }
      ],
      columns: [
        {
          prop: "measureRequire",
          label: "有关措施要求",
          align: "center",
          "min-width": "200px",
          render: (h, { row }) => {
            return (
              <div class='peizhi'>
                <LsdForm
                  compData={{
                    elType: "input",
                    id: "measureRequire",
                    label: "任务内容及要求",
                    attrs: {
                      disabled: false,
                      value: "",
                      placeholder: "请输入",
                      min: 0,
                      type: "text"
                    }
                  }}
                  form={row}
                  {...{
                    on: {}
                  }}
                ></LsdForm>
              </div>
            );
          }
        },
        {
          prop: "unitDeptName",
          // prop: "unitDeptId",
          label: "责任单位/部门",
          align: "center",
          "min-width": "80px",
          render: (h, scope) => {
            return (
              <div class='peizhi'>
                <LsdForm
                  compData={{
                    elType: "lsdTree",
                    id: "unitDeptName",
                    name: "unitDeptId",
                    keyWord: "keyWord",
                    treeRef: "treeRef",
                    commonClick: true,
                    label: " ",
                    isSplice: true,
                    chooseUnit: true,
                    attrs: {
                      value: "",
                      clearable: true,
                      "collapse-tags": true
                    },
                    options: {
                      attrs: {
                        disabled: true,
                        value: ""
                      }
                    },
                    treeData: {
                      attrs: {
                        data: _this.zrbmOption
                      },
                      props: {
                        children: "children",
                        label: "orgName",
                        value: "id"
                      }
                    }
                  }}
                  form={scope.row}
                  {...{
                    on: {
                      "node-click": (data, item) => { _this.handleClick(data, item, scope); }
                    }
                  }}
                ></LsdForm>
              </div>
            );
          }
        },
        {
          prop: "cz",
          label: "操作",
          align: "center",
          fixed: "right",
          "min-width": "40px",
          render: (h, { $index }) => {
            return (
              <div>
                {
                  $index == _this.config.table1.tableData.length - 1 && (
                    <img
                      {...{
                        class: {},
                        style: {
                          width: "16px",
                          height: "16px",
                          "margin-right": "10px",
                          cursor: "pointer"
                        },
                        attrs: {
                          src: require("../../../assets/img/listAdd.png")
                        },
                        on: {
                          click: (scope) => {
                            _this.$nextTick(() => {
                              _this.config.table1.tableData.push(
                                {
                                  taskContent: "",
                                  dutyDeptId: ""
                                }
                              );
                            });
                          }
                        }
                      }}
                    />
                  )
                }
                {_this.config.table1.tableData.length > 1 && (
                  <img
                    {...{
                      class: {},
                      style: {
                        width: "16px",
                        height: "16px",
                        cursor: "pointer"

                      },
                      attrs: {
                        src: require("../../../assets/img/listReduc.png")
                      },
                      on: {
                        click: () => {
                          _this.config.table1.tableData.splice($index, 1);
                        }
                      }
                    }}
                  />)}
              </div>
            );
          }
        }
      ],
      columns1: [
        {
          prop: "measureRequire",
          label: "有关措施要求",
          align: "left",
          "min-width": "200px",
          render: (h, { row }) => {
            return (
              <div class='peizhi'>
                {row.measureRequire}
              </div>
            );
          }
        },
        {
          prop: "unitDeptName",
          label: "责任单位/部门",
          align: "center",
          "min-width": "80px",
          render: (h, { row }) => {
            return (
              <div class='peizhi'>
                {row.unitDeptName}
              </div>
            );
          }
        }
      ],
      formLabel: {
        label: "有关措施要求：",
        prompt: false,
        width: "125px"
      },
      tableAttr: {
        // "max-height": "300px",
        stripe: false,
        border: true,
        fit: true,
        "show-header": true,
        "highlight-current-row": true,
        "cell-style": {
          "font-size": "16px"
        },
        "header-cell-style": {
          "text-align": "center",
          "background-color": "#B1C8F9",
          border: "1px solid #ccc",
          "font-size": "16px"
        }
      }
    }
  };
};
export default { config };
